//
//  LYQSettingsChangeNumberViewController.m
//  ZCProject
//
//  Created by Zheng on 16/11/23.
//  Copyright © 2016年 Zheng. All rights reserved.
//

#import "LYQSettingsChangeNumberViewController.h"

@interface LYQSettingsChangeNumberViewController () <UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UIButton *enterBtn; //确定按钮

@end

@implementation LYQSettingsChangeNumberViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"修改手机号";

    self.listTableView.delegate = self;
    self.listTableView.dataSource = self;
    self.listTableView.scrollEnabled = NO;
    
    [self.view addSubview:self.enterBtn];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    [_enterBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kWScale(44));
        make.right.mas_equalTo(-kWScale(44));
        make.height.equalTo(@(kWScale(40)));
        make.top.equalTo(@(kWScale(185)));
    }];
}

#pragma mark - load subviews
- (UIButton *)enterBtn {
    if (!_enterBtn) {
        _enterBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_enterBtn setTitle:@"确定" forState:UIControlStateNormal];
        [_enterBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _enterBtn.titleLabel.font = kWFont(16);
        _enterBtn.backgroundColor = kLYQBlue;
        _enterBtn.layer.cornerRadius = kWScale(20);
    }
    return _enterBtn;
}

#pragma mark - tableview datasource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [[UITableViewCell alloc] init];
    return cell;
}

#pragma mark - tableview delegate
#pragma mark 单元格高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return kWScale(50);
}

#pragma mark 头视图高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return kWScale(45);
}

#pragma mark 尾视图高度
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.0001f;
}

#pragma mark 自定义头视图
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kMS_Width, kWScale(45))];
    
    UIView *decorationView = [[UIView alloc] initWithFrame:CGRectMake(0, kWScale(31)/2, kWScale(4), kWScale(14))];
    decorationView.backgroundColor = kLYQBlue;
    
    UILabel *titleLbl = [[UILabel alloc] initWithFrame:CGRectMake(kWScale(20), 0, kWScale(200), kWScale(45))];
    titleLbl.text = @"输入新手机号并验证";
    titleLbl.textColor = kHexadecimal(@"666666");
    titleLbl.font = kWFont(15);
    
    [headerView addSubview:decorationView];
    [headerView addSubview:titleLbl];
    
    return headerView;
}


#pragma mark 设置分割线偏移量
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsMake(0, kWScale(10), 0, 0)];
    }
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsMake(0, kWScale(10), 0, 0)];
    }
}

#pragma mark - 内存警告
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
